-
Notifications
You must be signed in to change notification settings - Fork 800
Add support for setting custom bitmap cursors #10270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
18350b2 to
80b3462
Compare
80b3462 to
1768401
Compare
cf4124f to
d50c6ac
Compare
|
There is still some stuff in the TODO like documentation, but now that it works I would like some input on:
|
|
@redstrate There are quite a few people on vacation at the moment so replies/help might be slow till 2026 rolls around. |
d50c6ac to
e4c102f
Compare
ogoffart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is great work so far.
I'm on vacation at the moment but I just had a look over this PR anyway.
One thing I wonder is what to do with regard to scale factor. Especially when rendering SVG, we should probably take it into account.
| NeswResize, | ||
| /// Bidirectional resize north-west-south-east. | ||
| NwseResize, | ||
| /// Custom cursor from an `Image`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should document what the hotspot is and relative to what.
| #[non_exhaustive] | ||
| #[repr(C, u32)] | ||
| #[derive(Debug, Clone, PartialEq, Default)] | ||
| pub enum MouseCursor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when this was in the enums.rs macro, it got also automatic documentation in there: https://docs.slint.dev/latest/docs/slint/reference/gestures/toucharea/#mouse-cursor
Now, the documentation need to be written manually and kept in sync.
I wonder if it wouldn't be good to put that enum in i_slint_common, so it can be enumerated to generate the docs and avoid repetition in lookup.rs.
| ) | ||
| } | ||
| } | ||
| Expression::MouseCursor(MouseCursor::Default) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we would used strnum macros to simplify this. (same in rust)
e4c102f to
9aabd3a
Compare
Right now you can set the mouse cursor shape in a TouchArea to a pre-defined list of cursor shapes, but sometimes you have your own custom cursor set for actions that aren't in the CSS spec. This change introduces new API to set a mouse cursor to an Image, using the same property (mouse-cursor) and a changeable hotspot.
9aabd3a to
b902e48
Compare
| } | ||
|
|
||
| #[derive(Clone, Debug, Default)] | ||
| pub enum MouseCursor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet another place where MouseCursor is duplicated 😬 This is because there's two different Expression types here, maybe I can use generics here?
Right now you can set the mouse cursor shape in a TouchArea to a
pre-defined list of cursor shapes, but sometimes you have your own
custom cursor set for actions that aren't in the CSS spec.
This change introduces new API to set a mouse cursor to an Image, using
the same property (mouse-cursor) and a changeable hotspot.
Example
TODO
Link to existing issue/discussion